package org.example.demo9_compostie;

import java.util.ArrayList;
import java.util.List;

public class Folder implements VirusScanComponent{
    private String name;
    private List<VirusScanComponent> components;

    public Folder(String name) {
        this.name = name;
        this.components = new ArrayList<>();
    }
    @Override
    public void scan() {
        System.out.println("Scanning folder: " + name);
        for (VirusScanComponent component : components) {
            component.scan();
        }
    }

    public void add(VirusScanComponent component) {
        components.add(component);
    }

    public void remove(VirusScanComponent component) {
        components.remove(component);
    }
}
